home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-09-29 | 3.0 KB | 108 lines |
- '*******************************************************
- '* *
- '* AMOS Professional Procedure Library *
- '* *
- '* Procedure: Quatratic curve fractals *
- '* *
- '* Author: Hedwig Janssens *
- '* *
- '*******************************************************
- '
- ' Instructions
- ' ------------
-
- ' Press any key to move onto next fractal example and use
- ' the mouse buttons to rotate the screen colours.
- '
- Screen Open 0,320,256,32,LORES : Flash Off : Curs Off
- Do
- '------------------ Calculate palette --------------------
- Shift Off : Cls 0
- For X=0 To 15 : Colour X,X*256+X*16+X*0.8 : Next X
- For X=16 To 31 : C=31-X : Colour X,C*256+C*16+C*0.8 : Next X
- '------------------ Read data and plot fractal ------------
- Read G,Z,T
- _QUATALS[G,G,G,G,Z,T]
- '------------------ Fill entire screen --------------------
- GZ=G*2-1
- For X=0 To 320/(G*2) : For Y=0 To 256/(G*2)
- Screen Copy 0,0,0,GZ,GZ To 0,X*GZ,Y*GZ
- Next Y : Next X
- '------------------ Test mouse keys and color cycling -----
- Clear Key : MO=2
- Repeat
- MO=Mouse Key
- If MO=1 : Shift Down 5,0,31,1 : End If
- If MO=2 : Shift Up 5,0,31,1 : End If
- If MO=3 : Shift Off : End If
- Until Inkey$<>""
- Loop
- End
- '
- '----------------- Some examples. Data size,zoom,type ----
- Data 64,398,2
- Data 16,5,6
- Data 32,212,5
- Data 32,11,5
- Data 32,100,4
- Data 16,17,6
- Data 32,1111,3
- Data 32,124,3
- Data 32,8,1
- Data 64,641,1
- Data 64,6,2
- Data 32,9,4
- Data 32,24,3
- Data 128,5094,3
- '
- Procedure _QUATALS[XC,YC,XW,YH,Z,T]
- '
- ' Inputs: XC,YC Center coordinates
- ' XW Fractal width
- ' Yh Fractal height
- ' Z Zoom factor (Value depends on type)
- ' T fractal type (1-6)
- ' Outputs: Plots to current screen
- '
- If XC-XW<0 or XC+XW>Screen Width Then Pop Proc
- If YC-YW<0 or YC+YW>Screen Height Then Pop Proc
- XX=0 : YY=0 : CMAX=Screen Colour-1
- '
- If T=1
- For Y=-YH To YH : For X=-XW To XW
- Plot XC+X,YC+Y,(((X*X+Y*Y)*Z)/100) and CMAX
- Next X : Next Y
- End If
- '
- If T=2
- For Y=-YH To YH : For X=-XW To XW
- Plot XC+X,YC+Y,(((X*X-Y*Y)*Z)/100) and CMAX
- Next X : Next Y
- End If
- '
- If T=3
- For Y=-YH To YH : For X=-XW To XW
- XX=XX+X-Int(X/10)*10
- Plot XC+X,YC+Y,(((XX+YY)*Z)/100) and CMAX
- Next X : YY=YY+Y-Int(Y/10)*10
- Next Y
- End If
- '
- If T=4
- For Y=-YH To YH : For X=-XW To XW
- Plot XC+X,YC+Y,(((X*X*Y+X*Y*Y)*Z)/1000) and CMAX
- Next X : Next Y
- End If
- '
- If T=5
- For Y=-YH To YH : For X=-XW To XW
- Plot XC+X,YC+Y,((X*X*Y*Y)/Z) and CMAX
- Next X : Next Y
- End If
- '
- If T=6
- For Y=-YH To YH : For X=-XW To XW
- Plot XC+X,YC+Y,(X*Y*Z) and CMAX
- Next X : Next Y
- End If
- End Proc